Skip to content

Use atomics for exponential histogram buckets#8057

Merged
dashpole merged 3 commits intoopen-telemetry:mainfrom
dashpole:exphist_part_2
Mar 17, 2026
Merged

Use atomics for exponential histogram buckets#8057
dashpole merged 3 commits intoopen-telemetry:mainfrom
dashpole:exphist_part_2

Conversation

@dashpole
Copy link
Copy Markdown
Contributor

@dashpole dashpole commented Mar 13, 2026

Follows #8025

This is the second PR towards a lockless fast-path for the exponential histogram aggregation. It replaces use of uint64 with atomic.Uint64. It does not make buckets concurrent-safe. That will come in future PRs. This is a refactor to make future PRs easier to review since it has a large diff, but is relatively simple.

The record and measure calls are still guarded by a lock at this point.

You can see the full set of planned changes in main...dashpole:opentelemetry-go:lockless_exphist_ai. The implementation is largely based on #7535 (which I implemented by hand), but with help from an AI to break it down into smaller PRs, and simplify aspects of the design.

Part of #7796

@dashpole dashpole added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Mar 13, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.6%. Comparing base (d5f403c) to head (6f1babc).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8057   +/-   ##
=====================================
  Coverage   81.6%   81.6%           
=====================================
  Files        304     304           
  Lines      23452   23458    +6     
=====================================
+ Hits       19144   19150    +6     
- Misses      3926    3927    +1     
+ Partials     382     381    -1     
Files with missing lines Coverage Δ
...metric/internal/aggregate/exponential_histogram.go 98.6% <100.0%> (+<0.1%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dashpole dashpole marked this pull request as ready for review March 14, 2026 05:03
Comment thread sdk/metric/internal/aggregate/exponential_histogram.go
Comment thread sdk/metric/internal/aggregate/exponential_histogram.go
@dashpole dashpole merged commit 5576bc2 into open-telemetry:main Mar 17, 2026
32 checks passed
@dashpole dashpole deleted the exphist_part_2 branch March 17, 2026 14:45
@pellared pellared added this to the v1.43.0 milestone Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants